package com.xlh.openai.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xlh.openai.dao.TopicsDao;
import com.xlh.openai.entity.TopicsEntity;
import com.xlh.openai.service.TopicsService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import java.util.List;
import java.util.function.Function;


@Service("topicsService")
public class TopicsServiceImpl extends ServiceImpl<TopicsDao, TopicsEntity> implements TopicsService {

    @Override
    public List<TopicsEntity> listByRoleId(Integer roleId) {
        QueryWrapper<TopicsEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(TopicsEntity::getRoleId, roleId)
                             .or().eq(TopicsEntity::getRoleId, 0);
        List<TopicsEntity> list = list(queryWrapper);
        return list;
    }
}